// $Id: filemeshquadstate.h 72 2004-12-02 15:03:28Z jonas $
#ifndef FILEMESHQUADSTATE_H
#define FILEMESHQUADSTATE_H

#include "filemesh.h"

// TODO: Fine tune these parameters!
const int fileMeshQuadStateCount = 10000;

/**
 * This implmentation of the file mesh has the ability to set its "bits" in a
 * more statistical manner. Instead of just two values (0 and 1) it can store 4
 * values for each "bit"/chunk.
 */
class FileMeshQuadState : public FileMesh {
public:
	FileMeshQuadState();
	FileMeshQuadState(const FileMeshQuadState &);
	virtual ~FileMeshQuadState();

	FileMesh *newCopy();
	unsigned int calcDistance(unsigned int);
	void update(unsigned int, std::map<File *, StoredFile *> &);
	void rebuild(std::map<File *, StoredFile *> &);

private:
	unsigned char getQuad(int);
	void setQuad(int, unsigned char);
	int getIndex(int);

	unsigned char *m_bits;
};

#endif
